gtkbox: fix positioning of center widget
authorPaolo Borelli <pborelli@gnome.org>
Mon, 17 Feb 2014 22:19:10 +0000 (23:19 +0100)
committerPaolo Borelli <pborelli@gnome.org>
Mon, 17 Feb 2014 22:23:04 +0000 (23:23 +0100)
gtk/gtkbox.c

index 19bb0f96e6e18233826b299e0ffd6de58ae2179e..062008130f017f4d150b60af907d74082ed0fe21 100644 (file)
@@ -1137,7 +1137,11 @@ gtk_box_size_allocate_with_center (GtkWidget     *widget,
     }
 
   /* Allocate the center widget */
-  center_pos = (box_size - center_size) / 2;
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+    center_pos = allocation->x + (box_size - center_size) / 2;
+  else
+    center_pos = allocation->y + (box_size - center_size) / 2;
+
   if (center_pos < side[GTK_PACK_START])
     center_pos = side[GTK_PACK_START];
   else if (center_pos + center_size > side[GTK_PACK_END])